package network;

import java.util.ArrayList;

import commands.CallCommand;
import commands.CheckCommand;
import commands.Command;
import commands.FoldCommand;
import commands.RaiseCommand;
import controller.CommandManager;

public class IncomingCommunication {
	
	public IncomingCommunication(){
		
	}
	
	public void run(){
		int player = 1;
		int num = 4;
		int cType = 0;
		ArrayList<Command> cArray = new ArrayList<Command>();
		while(true){
			cArray = getCommandArray(cType);
			cType++; cType %= num;
			for(Command c : cArray){
				CommandManager.performActionCommand(c);
			}
		}
	}
	
	private ArrayList<Command> getCommandArray(int cType){
		ArrayList<Command> cA = new ArrayList<Command>();
		int num=4;
		if(cType == 0){
			for(int i=1; i<=num; i++){
				cA.add(new CallCommand(i));
			}			
		}else if(cType == 1){
			for(int i=1; i<=num; i++){
				cA.add(new CheckCommand(i));
			}			
		}else if(cType == 2){
			for(int i=1; i<=num; i++){
				cA.add(new RaiseCommand(i, 50));
			}			
		}else if(cType == 3){
			for(int i=1; i<=num; i++){
				cA.add(new FoldCommand(i));
			}			
		}
		
		return cA;
	}

}
